﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DataflowListModule.Views.NewDataflowView
{
    public partial class NewDataflowView : UserControl,INewDataflowView
    {
        public NewDataflowView()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(NewDataflowView_Loaded);
        }

        void NewDataflowView_Loaded(object sender, RoutedEventArgs e)
        {
          //  ((INewDataflowPrentationModel)this.DataContext).GetMainTask();
        }

        #region INewDataflowView Members

        public void SetModel(INewDataflowPrentationModel model)
        {
            this.DataContext = model;
            model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(model_PropertyChanged);
        }

        void model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "OutMessage" && ((INewDataflowPrentationModel)this.DataContext).OutMessage.ID > 0)
            {
                o1.UploadAtt(Guid.NewGuid(), ((INewDataflowPrentationModel)this.DataContext).OutMessage.ID);
            }
        }

        #endregion

        private void btnOutMSG_Click(object sender, RoutedEventArgs e)
        {
            ((INewDataflowPrentationModel)this.DataContext).SendOutMessage();
        }
    }
}
